home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 21.3 KB | 706 lines | [TEXT/MPS ] |
- ;
- ; File: Controls.a
- ;
- ; Contains: Control Manager interfaces
- ;
- ; Version: Technology: System 7.5
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__CONTROLS__') = 'UNDEFINED' THEN
- __CONTROLS__ SET 1
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
- include 'Quickdraw.a'
- ENDIF
- IF &TYPE('__MENUS__') = 'UNDEFINED' THEN
- include 'Menus.a'
- ENDIF
- IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL DEFINITION ID'S
- ;_________________________________________________________________________________________________________
- ; Standard System 7 procID's
- ;
-
- pushButProc EQU 0
- checkBoxProc EQU 1
- radioButProc EQU 2
- scrollBarProc EQU 16
- popupMenuProc EQU 1008
- ;
- ;_________________________________________________________________________________________________________
- ; • VARIANT CODES
- ;_________________________________________________________________________________________________________
- ;
- ; typedef SInt16 ControlVariant
-
-
- kControlNoVariant EQU 0 ; No variant
- kControlUsesOwningWindowsFontVariant EQU $08 ; Control uses owning windows font to display text
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL PART CODES
- ;_________________________________________________________________________________________________________
- ;
- ; typedef SInt16 ControlPartCode
-
-
- kControlNoPart EQU 0
- kControlLabelPart EQU 1
- kControlMenuPart EQU 2
- kControlTrianglePart EQU 4
- kControlButtonPart EQU 10
- kControlCheckBoxPart EQU 11
- kControlRadioButtonPart EQU 11
- kControlUpButtonPart EQU 20
- kControlDownButtonPart EQU 21
- kControlPageUpPart EQU 22
- kControlPageDownPart EQU 23
- kControlIndicatorPart EQU 129
- kControlDisabledPart EQU 254
- kControlInactivePart EQU 255
- ;
- ;_________________________________________________________________________________________________________
- ; • CHECK BOX VALUES
- ;_________________________________________________________________________________________________________
- ;
-
- kControlCheckBoxUncheckedValue EQU 0
- kControlCheckBoxCheckedValue EQU 1
- kControlCheckBoxMixedValue EQU 2
- ;
- ;_________________________________________________________________________________________________________
- ; • RADIO BUTTON VALUES
- ;_________________________________________________________________________________________________________
- ;
-
- kControlRadioButtonUncheckedValue EQU 0
- kControlRadioButtonCheckedValue EQU 1
- kControlRadioButtonMixedValue EQU 2
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL POP-UP MENU CONSTANTS
- ;_________________________________________________________________________________________________________
- ; Variant codes for the System 7 pop-up menu
- ;
-
- popupFixedWidth EQU $01
- popupVariableWidth EQU $02
- popupUseAddResMenu EQU $04
- popupUseWFont EQU $08
- ; Menu label styles for the System 7 pop-up menu
-
- popupTitleBold EQU $0100
- popupTitleItalic EQU $0200
- popupTitleUnderline EQU $0400
- popupTitleOutline EQU $0800
- popupTitleShadow EQU $1000
- popupTitleCondense EQU $2000
- popupTitleExtend EQU $4000
- popupTitleNoStyle EQU $8000
- ; Menu label justifications for the System 7 pop-up menu
-
- popupTitleLeftJust EQU $00000000
- popupTitleCenterJust EQU $00000001
- popupTitleRightJust EQU $000000FF
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL DRAGGRAYRGN CONSTANTS
- ; For DragGrayRgnUPP used in TrackControl()
- ;_________________________________________________________________________________________________________
- ;
-
- noConstraint EQU 0
- hAxisOnly EQU 1
- vAxisOnly EQU 2
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL COLOR TABLE PART CODES
- ;_________________________________________________________________________________________________________
- ;
-
- cFrameColor EQU 0
- cBodyColor EQU 1
- cTextColor EQU 2
- cThumbColor EQU 3
- kNumberCtlCTabEntries EQU 4
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROLHANDLE & CONTROLREF
- ;_________________________________________________________________________________________________________
- ;
-
-
- ; typedef ControlRecord * ControlPtr
-
- ; typedef ControlPtr * ControlHandle
-
- ; typedef ControlHandle ControlRef
-
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL ACTIONPROC POINTER
- ;_________________________________________________________________________________________________________
- ;
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL COLOR TABLE
- ;_________________________________________________________________________________________________________
- ;
- CtlCTab RECORD 0
- ccSeed ds.l 1 ; offset: $0 (0)
- ccRider ds.w 1 ; offset: $4 (4)
- ctSize ds.w 1 ; offset: $6 (6)
- ctTable ds.b 4 * ColorSpec.sizeof ; offset: $8 (8)
- sizeof EQU * ; size: $28 (40)
- ENDR
- ; typedef struct CtlCTab * CCTabPtr
-
- ; typedef CCTabPtr * CCTabHandle
-
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL RECORD
- ;_________________________________________________________________________________________________________
- ;
- ControlRecord RECORD 0
- nextControl ds.l 1 ; offset: $0 (0)
- contrlOwner ds.l 1 ; offset: $4 (4)
- contrlRect ds Rect ; offset: $8 (8)
- contrlVis ds.b 1 ; offset: $10 (16)
- contrlHilite ds.b 1 ; offset: $11 (17)
- contrlValue ds.w 1 ; offset: $12 (18)
- contrlMin ds.w 1 ; offset: $14 (20)
- contrlMax ds.w 1 ; offset: $16 (22)
- contrlDefProc ds.l 1 ; offset: $18 (24)
- contrlData ds.l 1 ; offset: $1C (28)
- contrlAction ds.l 1 ; offset: $20 (32)
- contrlRfCon ds.l 1 ; offset: $24 (36)
- contrlTitle ds Str255 ; offset: $28 (40)
- sizeof EQU * ; size: $128 (296)
- ENDR
- ;
- ;_________________________________________________________________________________________________________
- ; • AUXILLARY CONTROL RECORD STRUCTURE
- ;_________________________________________________________________________________________________________
- ;
- AuxCtlRec RECORD 0
- acNext ds.l 1 ; offset: $0 (0)
- acOwner ds.l 1 ; offset: $4 (4)
- acCTable ds.l 1 ; offset: $8 (8)
- acFlags ds.w 1 ; offset: $C (12)
- acReserved ds.l 1 ; offset: $E (14)
- acRefCon ds.l 1 ; offset: $12 (18)
- sizeof EQU * ; size: $16 (22)
- ENDR
- ; typedef struct AuxCtlRec * AuxCtlPtr
-
- ; typedef AuxCtlPtr * AuxCtlHandle
-
- ;
- ;_________________________________________________________________________________________________________
- ; • POP-UP MENU PRIVATE DATA STRUCTURE
- ;_________________________________________________________________________________________________________
- ;
- PopupPrivateData RECORD 0
- mHandle ds.l 1 ; offset: $0 (0)
- mID ds.w 1 ; offset: $4 (4)
- sizeof EQU * ; size: $6 (6)
- ENDR
- ; typedef struct PopupPrivateData * PopupPrivateDataPtr
-
- ; typedef PopupPrivateDataPtr * PopupPrivateDataHandle
-
- ;
- ;_________________________________________________________________________________________________________
- ; • CONTROL ACTION PROC UPP'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL CREATION / DELETION API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal ControlHandle NewControl(WindowPtr owningWindow, const Rect *boundsRect, ConstStr255Param controlTitle, Boolean initiallyVisible, SInt16 initialValue, SInt16 minimumValue, SInt16 maximumValue, SInt16 procID, SInt32 controlReference)
- ;
- IF ¬ GENERATINGCFM THEN
- _NewControl: OPWORD $A954
- ELSE
- IMPORT_CFM_FUNCTION NewControl
- ENDIF
-
- ;
- ; pascal ControlHandle GetNewControl(SInt16 resourceID, WindowPtr owningWindow)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetNewControl: OPWORD $A9BE
- ELSE
- IMPORT_CFM_FUNCTION GetNewControl
- ENDIF
-
- ;
- ; pascal void DisposeControl(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _DisposeControl: OPWORD $A955
- ELSE
- IMPORT_CFM_FUNCTION DisposeControl
- ENDIF
-
- ;
- ; pascal void KillControls(WindowPtr theWindow)
- ;
- IF ¬ GENERATINGCFM THEN
- _KillControls: OPWORD $A956
- ELSE
- IMPORT_CFM_FUNCTION KillControls
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL SHOWING/HIDING API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void ShowControl(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _ShowControl: OPWORD $A957
- ELSE
- IMPORT_CFM_FUNCTION ShowControl
- ENDIF
-
- ;
- ; pascal void HideControl(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _HideControl: OPWORD $A958
- ELSE
- IMPORT_CFM_FUNCTION HideControl
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL DRAWING API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void DrawControls(WindowPtr theWindow)
- ;
- IF ¬ GENERATINGCFM THEN
- _DrawControls: OPWORD $A969
- ELSE
- IMPORT_CFM_FUNCTION DrawControls
- ENDIF
-
- ;
- ; pascal void Draw1Control(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _Draw1Control: OPWORD $A96D
- ELSE
- IMPORT_CFM_FUNCTION Draw1Control
- ENDIF
-
- ;
- ; pascal void UpdateControls(WindowPtr theWindow, RgnHandle updateRegion)
- ;
- IF ¬ GENERATINGCFM THEN
- _UpdateControls: OPWORD $A953
- ELSE
- IMPORT_CFM_FUNCTION UpdateControls
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL HIGHLIGHT API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void HiliteControl(ControlHandle theControl, ControlPartCode hiliteState)
- ;
- IF ¬ GENERATINGCFM THEN
- _HiliteControl: OPWORD $A95D
- ELSE
- IMPORT_CFM_FUNCTION HiliteControl
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL TRACKING/DRAGGING API'S
- ;_________________________________________________________________________________________________________
- ; When using the TrackControl() call when tracking an indicator, the actionProc parameter (type ControlActionUPP)
- ; should be replaced by a parameter of type DragGrayRgnUPP (see Quickdraw.h).
- ;
- ;
- ; pascal ControlPartCode TrackControl(ControlHandle theControl, Point startPoint, ControlActionUPP actionProc)
- ;
- IF ¬ GENERATINGCFM THEN
- _TrackControl: OPWORD $A968
- ELSE
- IMPORT_CFM_FUNCTION TrackControl
- ENDIF
-
- ;
- ; pascal void DragControl(ControlHandle theControl, Point startPoint, const Rect *limitRect, const Rect *slopRect, DragConstraint axis)
- ;
- IF ¬ GENERATINGCFM THEN
- _DragControl: OPWORD $A967
- ELSE
- IMPORT_CFM_FUNCTION DragControl
- ENDIF
-
- ;
- ; pascal ControlPartCode TestControl(ControlHandle theControl, Point testPoint)
- ;
- IF ¬ GENERATINGCFM THEN
- _TestControl: OPWORD $A966
- ELSE
- IMPORT_CFM_FUNCTION TestControl
- ENDIF
-
- ;
- ; pascal ControlPartCode FindControl(Point testPoint, WindowPtr theWindow, ControlHandle *theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _FindControl: OPWORD $A96C
- ELSE
- IMPORT_CFM_FUNCTION FindControl
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL MOVING/SIZING API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void MoveControl(ControlHandle theControl, SInt16 h, SInt16 v)
- ;
- IF ¬ GENERATINGCFM THEN
- _MoveControl: OPWORD $A959
- ELSE
- IMPORT_CFM_FUNCTION MoveControl
- ENDIF
-
- ;
- ; pascal void SizeControl(ControlHandle theControl, SInt16 w, SInt16 h)
- ;
- IF ¬ GENERATINGCFM THEN
- _SizeControl: OPWORD $A95C
- ELSE
- IMPORT_CFM_FUNCTION SizeControl
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL TITLE API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void SetControlTitle(ControlHandle theControl, ConstStr255Param title)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlTitle: OPWORD $A95F
- ELSE
- IMPORT_CFM_FUNCTION SetControlTitle
- ENDIF
-
- ;
- ; pascal void GetControlTitle(ControlHandle theControl, Str255 title)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlTitle: OPWORD $A95E
- ELSE
- IMPORT_CFM_FUNCTION GetControlTitle
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL VALUE, MIMIMUM, AND MAXIMUM API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal SInt16 GetControlValue(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlValue: OPWORD $A960
- ELSE
- IMPORT_CFM_FUNCTION GetControlValue
- ENDIF
-
- ;
- ; pascal void SetControlValue(ControlHandle theControl, SInt16 newValue)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlValue: OPWORD $A963
- ELSE
- IMPORT_CFM_FUNCTION SetControlValue
- ENDIF
-
- ;
- ; pascal SInt16 GetControlMinimum(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlMinimum: OPWORD $A961
- ELSE
- IMPORT_CFM_FUNCTION GetControlMinimum
- ENDIF
-
- ;
- ; pascal void SetControlMinimum(ControlHandle theControl, SInt16 newMinimum)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlMinimum: OPWORD $A964
- ELSE
- IMPORT_CFM_FUNCTION SetControlMinimum
- ENDIF
-
- ;
- ; pascal SInt16 GetControlMaximum(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlMaximum: OPWORD $A962
- ELSE
- IMPORT_CFM_FUNCTION GetControlMaximum
- ENDIF
-
- ;
- ; pascal void SetControlMaximum(ControlHandle theControl, SInt16 newMaximum)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlMaximum: OPWORD $A965
- ELSE
- IMPORT_CFM_FUNCTION SetControlMaximum
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL VARIANT AND WINDOW INFORMATION API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal ControlVariant GetControlVariant(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlVariant: OPWORD $A809
- ELSE
- IMPORT_CFM_FUNCTION GetControlVariant
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL ACTION PROC API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void SetControlAction(ControlHandle theControl, ControlActionUPP actionProc)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlAction: OPWORD $A96B
- ELSE
- IMPORT_CFM_FUNCTION SetControlAction
- ENDIF
-
- ;
- ; pascal ControlActionUPP GetControlAction(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlAction: OPWORD $A96A
- ELSE
- IMPORT_CFM_FUNCTION GetControlAction
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL ACCESSOR API'S
- ;_________________________________________________________________________________________________________
- ;
- ;
- ; pascal void SetControlReference(ControlHandle theControl, SInt32 data)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlReference: OPWORD $A95B
- ELSE
- IMPORT_CFM_FUNCTION SetControlReference
- ENDIF
-
- ;
- ; pascal SInt32 GetControlReference(ControlHandle theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlReference: OPWORD $A95A
- ELSE
- IMPORT_CFM_FUNCTION GetControlReference
- ENDIF
-
- ;
- ; pascal Boolean GetAuxiliaryControlRecord(ControlHandle theControl, AuxCtlHandle *acHndl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetAuxiliaryControlRecord: OPWORD $AA44
- ELSE
- IMPORT_CFM_FUNCTION GetAuxiliaryControlRecord
- ENDIF
-
- ;
- ; pascal void SetControlColor(ControlHandle theControl, CCTabHandle newColorTable)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlColor: OPWORD $AA43
- ELSE
- IMPORT_CFM_FUNCTION SetControlColor
- ENDIF
-
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • VALID 'CDEF' MESSAGES
- ;_________________________________________________________________________________________________________
- ;
- ; typedef SInt16 ControlDefProcMessage
-
-
- drawCntl EQU 0
- testCntl EQU 1
- calcCRgns EQU 2
- initCntl EQU 3
- dispCntl EQU 4
- posCntl EQU 5
- thumbCntl EQU 6
- dragCntl EQU 7
- autoTrack EQU 8
- calcCntlRgn EQU 10
- calcThumbRgn EQU 11
- drawThumbOutline EQU 12
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • MAIN ENTRY POINT FOR 'CDEF'
- ;_________________________________________________________________________________________________________
- ;
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONSTANTS FOR DRAWCNTL MESSAGE PASSED IN PARAM
- ;_________________________________________________________________________________________________________
- ;
-
- kDrawControlEntireControl EQU 0
- kDrawControlIndicatorOnly EQU 129
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • CONSTANTS FOR DRAGCNTL MESSAGE PASSED IN PARAM
- ;_________________________________________________________________________________________________________
- ;
-
- kDragControlEntireControl EQU 0
- kDragControlIndicator EQU 1
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; • DRAG CONSTRAINT STRUCTURE PASSED IN PARAM FOR THUMBCNTL MESSAGE (IM I-332)
- ;_________________________________________________________________________________________________________
- ;
- IndicatorDragConstraint RECORD 0
- limitRect ds Rect ; offset: $0 (0)
- slopRect ds Rect ; offset: $8 (8)
- axis ds.w 1 ; offset: $10 (16)
- sizeof EQU * ; size: $12 (18)
- ENDR
- ; typedef struct IndicatorDragConstraint * IndicatorDragConstraintPtr
-
- ; typedef IndicatorDragConstraintPtr * IndicatorDragConstraintHandle
-
- IF OLDROUTINENAMES THEN
- ;
- ;_________________________________________________________________________________________________________
- ; • OLDROUTINENAMES
- ;_________________________________________________________________________________________________________
- ; Variants applicable to all controls (at least ones with text)
- ;
-
- useWFont EQU 8
-
- inLabel EQU 1
- inMenu EQU 2
- inTriangle EQU 4
- inButton EQU 10
- inCheckBox EQU 11
- inUpButton EQU 20
- inDownButton EQU 21
- inPageUp EQU 22
- inPageDown EQU 23
- inThumb EQU 129
-
- kNoHiliteControlPart EQU 0
- kInLabelControlPart EQU 1
- kInMenuControlPart EQU 2
- kInTriangleControlPart EQU 4
- kInButtonControlPart EQU 10
- kInCheckBoxControlPart EQU 11
- kInUpButtonControlPart EQU 20
- kInDownButtonControlPart EQU 21
- kInPageUpControlPart EQU 22
- kInPageDownControlPart EQU 23
- kInIndicatorControlPart EQU 129
- kReservedControlPart EQU 254
- kControlInactiveControlPart EQU 255
- ENDIF
- ;
- ;*****************************************************************************
- ;* *
- ;* The conditional STRICT_CONTROLS has been removed from this interface file.*
- ;* The accessor macros to a ControlRecord are no longer necessary. *
- ;* *
- ;*****************************************************************************
- ;
- ;Details:
- ;The original purpose of the STRICT_ conditionals and accessor macros was to
- ;help ease the transition to Copland. Shared data structures are difficult
- ;to coordinate in a preemptive multitasking OS. By hiding the fields in a
- ;WindowRecord and other data structures, we would begin the migration to
- ;system data structures being completely hidden from applications.
- ;
- ;After many design reviews, it was finally concluded that with this sort of
- ;migration, the system could never tell when an application was no longer
- ;peeking at a WindowRecord, and thus the data structure might never become
- ;system owned. Additionally, there were many other limitations in the classic
- ;toolbox that were begging to be addressed.
- ;
- ;The final decision was to leave the traditional toolbox as a compatibility mode.
- ;The preferred toolbox API for Copland is a new SOM(tm) based architecture
- ;(e.g. HIWindows.idl). Windows, menu, controls, etc are each a SOM object
- ;with methods for drawing, event handling, and customization.
- ;
- ;
- ENDIF
- ENDIF ; __CONTROLS__
-
-